//
//  GuideViewController.m
//  LittleFairyPoet
//
//  Created by rimi on 15/9/15.
//  Copyright (c) 2015年 周林. All rights reserved.
//

#import "WPGuideViewController.h"

#define GUIDE_DETAIL @"   本应用旨在帮助家长培养孩子对中国古诗歌的兴趣!本应用主要功能如下：\n\n       \n查找模块：\n       您可以直接阅读诗词以及译文，亦可以从此进入游戏界面，并对喜欢的诗词进行收藏。方便下次查找\n\n    \n游戏模块:\n       此模式分为两个模块。\n       普通模式：根据诗词上下文提示，选择正确的字完善缺省诗词，以加深对诗词的记忆。\n       挑战模式：选择下方相应的字，来达到默写的效果，完成后进行提交，系统会给出相应得分。\n\n学习计划：\n       在此，家长可以根据孩子情况添加相应的学习计划，并设置提醒。"


@interface WPGuideViewController ()
@property (nonatomic, strong) UITextView * textView;
- (void)initializeUserInterface; /**< 初始化用户界面 */

@end

@implementation WPGuideViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self initializeUserInterface];
    
}
#pragma mark - private methods
- (void)initializeUserInterface {
    self.view.backgroundColor = [UIColor whiteColor];
    self.automaticallyAdjustsScrollViewInsets = NO;
    [self.view addSubview:self.textView];
    self.titleLable.text = @"使用说明";
}
#pragma getter
- (UITextView *)textView {
    if (!_textView) {
        _textView = ({
            UITextView * textView = [[UITextView alloc]initWithFrame:DHFlexibleFrame(CGRectMake(10, 64, 300, ORIGIN_HEIGHT-64), NO)];
            textView.editable = NO;
            textView.text = GUIDE_DETAIL;
            textView.autoresizingMask = UIViewAutoresizingFlexibleHeight;
            NSMutableAttributedString * attributedString = [[NSMutableAttributedString alloc]initWithString:textView.text];
            NSMutableParagraphStyle * paragraphStyle = [[NSMutableParagraphStyle alloc]init];
            [paragraphStyle setLineSpacing:8 *DHFlexibleVerticalMutiplier()];
            [attributedString addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, textView.text.length)];
            textView.attributedText = attributedString;
            textView.font = [UIFont systemFontOfSize:20];
//            textView.pagingEnabled = YES;
            textView;
        });
    }
    return _textView;
}
@end
